/** ====== 全局公共方法 ======*/
let funs = {
    /** 加载模块 */
    getModule: function (moduleSrc, parent, cb) {
        //截取模块的名字； 此处限制了module下不能有三级目录，也就是说module下的文件夹只能是代表一个模块；不能嵌套文件夹；
        let moduleName = moduleSrc.split('modules/')[1].split('.')[0];
        let moduleNameNohash = moduleName.split('-')[0];
        let that = this;
        // 如果已经取过dom，则直接渲染
        if (that.hasLoadHtml[moduleNameNohash]) {
            parent.append(that.hasLoadHtml[moduleNameNohash]);
            that.loadModule(moduleName, moduleNameNohash, cb);
        } else {
            $.ajax({
                type: 'GET',
                url: 'modules/' + moduleNameNohash + '.html',
                dataType: "html",
                success: function (result) {
                    // 存dom
                    that.hasLoadHtml[moduleNameNohash] = result;
                    // 插入dom
                    parent.append(result);
                    that.loadModule(moduleName, moduleNameNohash, cb);
                },
                error: function () {
                    funs.tip('加载失败，请检查网络后重试', '', 'fail');
                    cb.fail() && cb.fail();
                }
            })
        }

    },
    /** 侧滑显示模块
     *  width: 从左滑出的不是全屏的模块的显示宽度百分比（eg: 60%）；默认100%；可不传值；
     *  direction: top(从下往上滑出) / left(从右往左滑出)
     *  callback: function (){}
     *  isUrl: 当前模块是否作为独立的有url的页面存在
     *  type: page(全屏模块) modal(弹窗模块)
     * */
    swipeModule: function (moduleSrc, width, dir, callback, isUrl) {
        if (!this.firstClick) {
            return
        }
        this.firstClick = false;

        let moduleName = moduleSrc.split('modules/')[1].split('.')[0];
        let moduleNameNohash = moduleName.split('-')[0];//不带hash的路径
        let modNameId = moduleNameNohash;//模块id
        if (moduleNameNohash.indexOf('/') > 0) {
            let arr = moduleNameNohash.split('/');
            modNameId = arr[arr.length - 1];
        }
        let that = this;
        let moduleWidth = width || '100%'; //模块宽度
        let direction = dir || 'left';
        let isUrlPage = isUrl || false;
        //获取当前展开的page个数
        let index = parseInt($('[type="AsideModal"]').length);
        //获取当前展开的弹窗个数
        let ci = parseInt($('[type="CenterModal"]').length);
        //转换宽度和边距
        let moduleLeft = '0%';
        moduleWidth = parseInt(moduleWidth);
        if (moduleWidth != 100) {
            moduleLeft = (100 - moduleWidth) + '%';
        }
        let background = ';';
        if (width != '100%') {
            background = ';background-color: rgba(0,0,0,.5)';
        }
        // 如果已经取过dom，则直接渲染
        if (that.hasLoadHtml[moduleNameNohash]) {
            displayModule(that.hasLoadHtml[moduleNameNohash]);
        } else {
            $.ajax({
                type: 'GET',
                url: 'modules/' + moduleNameNohash + '.html',
                dataType: "html",
                success: function (result) {
                    let moduleDom = result;
                    that.hasLoadHtml[moduleNameNohash] = moduleDom;
                    displayModule(moduleDom);
                },
                error: function () {
                    funs.tip('加载失败，请检查网络后重试', '', 'fail');
                }
            });
        }
        function displayModule(module) {
            let dom = '<div id="asideModulePanel' + index + '" type="AsideModal" isUrl="' + isUrlPage + '" moduleUrl="' + moduleSrc + '" module-name="' + modNameId + '" style="z-index:' + (1000 + index + ci) + background + '"><div class="asideModuleContent ' + direction + '" style="width:' + width + background + '"><div class="content">' + module + '</div></div></div>';
            // 插入dom，并改变body的overflow，阻止浮层下的页面能继续滚动的情形；
            $('body').append(dom).css('overflow', 'hidden');
            let panel = $('#asideModulePanel' + index);
            that.loadModule(moduleName, moduleNameNohash, function (mod) {
                if (direction == 'top') {
                    panel.find('.asideModuleContent').css('top', '0%');
                } else if (direction == 'left') {
                    panel.find('.asideModuleContent').css('left', moduleLeft);
                }
                mod.config = {
                    direction: direction,
                    isUrl: isUrlPage,
                    parent: panel,
                    type: 'page'
                };
                callback && callback(mod);
                Router.direction = 'forward';
                that.firstClick = true;

                //移除当前模块，返回上一页;
                panel.find('.goBack').on('click', function (e) {
                    //移除的动画方向
                    if (direction == 'top') {
                        panel.find('.asideModuleContent').css('top', '100%');
                    } else if (direction == 'left') {
                        panel.find('.asideModuleContent').css('left', '100%');
                    }

                    // 当前页面是路由页面的话
                    if (panel.attr('isUrl') == 'true') {
                        // 如果无历史记录，或者上一页是空白页，则回到首页；其他自然情况goback
                        if (document.referrer == "" || history.length == '1') {
                            location.hash = 'index';
                        } else {
                            history.go(-1);
                        }
                    }
                    mod.afterUninstall && mod.afterUninstall();
                    setTimeout(function () {
                        panel.remove();
                    }, 310);
                    $('body').css('overflow', 'inherit');
                });
                //点击空白处收起侧边，然后移除当前div
                panel.on('click', function (e) {
                    if (e.target == this) {
                        //移除的动画方向
                        if (direction == 'top') {
                            panel.find('.asideModuleContent').css('top', '100%');
                        } else if (direction == 'left') {
                            panel.find('.asideModuleContent').css('left', '100%');
                        }
                        // 当前页面是路由页面的话
                        if (panel.attr('isUrl') == 'true') {
                            // 如果无历史记录，或者上一页是空白页，则回到首页；其他自然情况goback
                            if (document.referrer == "" || history.length == '1') {
                                location.hash = 'index';
                            } else {
                                history.go(-1);
                            }
                        }
                        setTimeout(function () {
                            panel.remove();
                            mod.afterUninstall && mod.afterUninstall();
                        }, 310);
                        $('body').css('overflow', 'inherit');
                    }
                });
            });
        }
    },
    loadModule: function (name, nameNoHash, cb) {
        let that = this;
        require(["../modules/" + name + ".js"], function (mod) {
            if (nameNoHash.indexOf('/') > 0) {
                nameNoHash = nameNoHash.split('/')[1];
            }
            let module = new mod.Module($('#' + nameNoHash));
            that.hasLoadModuleArray[nameNoHash] = module;
            cb && cb(module);
        });
    },
    /** 获取模块类的functions */
    getModuleFuns: function (src, cb) {
        let that = this;
        let moduleName = src.split('modules/')[1].split('.')[0];
        let moduleNameNohash = moduleName.split('-')[0];

        if (moduleNameNohash.indexOf('/') > 0) {
            moduleNameNohash = moduleNameNohash.split('/')[1];
        }
        // 如果加载过模块，则直接返回；没加载过，则先new再返回
        if (that.hasLoadModuleArray[moduleNameNohash]) {
            cb && cb(that.hasLoadModuleArray[moduleNameNohash])
        } else {
            require(["../" + src], function (mod) {
                let module = new mod.Module($('#' + moduleNameNohash));
                cb && cb(module)
            });
        }
    },
    /** 打开弹窗模块 */
    openModal(moduleSrc, callback) {
        if (!this.firstClick) {
            return
        }
        this.firstClick = false;

        let moduleName = moduleSrc.split('modules/')[1].split('.')[0];
        let moduleNameNohash = moduleName.split('-')[0];
        let modNameId = moduleNameNohash;//模块id
        if (moduleNameNohash.indexOf('/') > 0) {
            let arr = moduleNameNohash.split('/');
            modNameId = arr[arr.length - 1];
        }
        //如果当前弹窗已经存在（正在显示），直接移除。
        if (this.isExistModal(modNameId)) {
            this.isExistModal(modNameId).remove();
        }
        let that = this;


        //获取当前展开的弹窗个数
        let index = parseInt($('[type="CenterModal"]').length);
        //获取当前展开的页面个数
        let ai = parseInt($('[type="AsideModal"]').length);
        // 如果已经取过dom，则直接渲染
        if (that.hasLoadHtml[moduleNameNohash]) {
            displayModal(that.hasLoadHtml[moduleNameNohash]);
        } else {
            $.ajax({
                type: 'GET',
                url: 'modules/' + moduleNameNohash + '.html',
                dataType: "html",
                success: function (result) {
                    let moduleDom = result;
                    that.hasLoadHtml[moduleNameNohash] = moduleDom;
                    displayModal(moduleDom);
                },
                error: function () {
                    that.tip('加载失败，请检查网络后重试');
                    that.firstClick = true;
                }

            });
        }
        function displayModal(module) {
            let dom = '<div id="CenterModulePanel' + index + '" type="CenterModal" moduleUrl="' + moduleSrc + '" module-name="' + modNameId + '" style="z-index:' + (1000 + index + ai) + '"><div class="CenterModalContent"><span class="icon-cross"></span>' + module + '</div></div>';
            // 插入dom，并改变body的overflow，阻止浮层下的页面能继续滚动的情形；
            $('body').append(dom).css('overflow', 'hidden');
            let panel = $('#CenterModulePanel' + index);
            that.loadModule(moduleName, moduleNameNohash, function (mod) {
                mod.config = {
                    parent: panel,
                    type: 'modal'
                };
                callback && callback(mod);
                that.firstClick = true;

                //点击空白处或关闭图标，关闭弹窗，然后移除当前div
                panel.on('click', function (e) {
                    if (e.target == this || e.target.className == 'icon-cross') {
                        panel.find('.CenterModalContent').css({ 'transform': 'scale(0,0)', 'opacity': '0' });
                        mod.afterUninstall && mod.afterUninstall();
                        setTimeout(function () {
                            panel.remove();
                        }, 310);
                        $('body').css('overflow', 'inherit');
                    }
                });
            });
        }
    },
    //已经加载过的模块
    hasLoadModuleArray: {},
    // 是否是正存在且尚未移除的page
    isExistPage: function (modName) {
        let mods = $('div[type="AsideModal"]');
        let flag = false;
        $.each(mods, function (index, item) {
            if ($(item).attr('module-name') == modName) {
                flag = true;
            }
        });
        return flag
    },
    // 是否是正存在且尚未移除的modal
    isExistModal: function (modName) {
        let mods = $('div[type="CenterModal"]');
        let flag = false;
        $.each(mods, function (index, item) {
            if ($(item).attr('module-name') == modName) {
                flag = $(item);
            }
        });
        return flag
    },
    //已经加载过的html
    hasLoadHtml: {},
    // 阻止多次重复点击按钮，调用重复的模块渲染
    firstClick: true,
    /** 移除某个模块之上的其他模块page，展示此模块的页面*/
    routeToModule: function (moduleName) {
        //回到首页
        if (moduleName == 'index') {
            let mod = $('div[type="AsideModal"]');
            //如果当前非首页
            if (mod.length > 0) {
                mod.find('.asideModuleContent').css('left', '100%');
                funs.getModuleFuns(mod.attr('moduleUrl'), function (module) {
                    module.afterUninstall && module.afterUninstall();
                });
                $('body').css('overflow', 'inherit');
                setTimeout(function () {
                    mod.remove();
                }, 310);
            }
            document.title = "万屏汇";


            // 此模块必须加载过
        } else if (funs.hasLoadModuleArray[moduleName]) {
            // 取到当前模块的page dom
            let currMod = $('div[module-name=' + moduleName + ']');
            let index = currMod.attr('id').substr(-1, 1);
            if (currMod && currMod.length > 0) {
                // 获取所有已经load的page
                let loadPages = $('div[type="AsideModal"]');
                $.each(loadPages, function (i, item) {
                    // 移除所有后加载的page
                    if (i > index) {
                        $(item).find('.asideModuleContent').css('left', '100%');
                        funs.getModuleFuns($(item).attr('moduleUrl'), function (module) {
                            module.afterUninstall && module.afterUninstall();
                        });
                        setTimeout(function () {
                            $(item).remove();
                        }, 310);
                    }
                })
            }
        } else {
            location.hash = 'index';
        }

    },
    /**验证邮箱 */
    checkEmail: function (mail) {
        let msg = '';
        let pattern = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
        if (!pattern.test(mail)) {
            msg = "请输入正确的邮箱地址";
            return msg;
        }
        return true;
    },
    /**计算json数据的条目数*/
    jsonLength: function (json) {
        let count = 0;
        for (let item in json) {
            count++;
        }
        return count
    },
    /**获取当前日期 */
    getCurrentTime: function () {
        let myDate = new Date();
        let date = myDate.toLocaleDateString();     //
        let mytime = myDate.toLocaleTimeString();     //获取当前时间
        let time = mytime.substr(2, mytime.length);
        let halfDay = mytime.substr(0, 2);
        let array = time.split(':');
        if (halfDay == '下午') {
            array[0] = parseInt(array[0]) + 12;
            time = array.join(':');
        } else {
            //如果是上午12点，则变成0点
            if (array[0] == '12') {
                array[0] = '00';
                time = array.join(':');
            }
        }
        let currentTime = {
            "date": date,//2017-11-15
            "time": time //12:00:00
        };
        return currentTime
    },
    /**UTC时间格式转换*/
    dateUTC: function (time) {
        let date = new Date(time);
        let localeString = date.toLocaleString();
        let localeDateString = date.toLocaleDateString();
        let localeTimeString = date.toLocaleTimeString();
        let Time = {
            "dateString": localeString,//2017/11/15 上午12:00:00
            "date": localeDateString,//2017-11-15
            "time": localeTimeString //12:00:00
        };
        return Time
    },
    /** 获取url的query值 */
    qs: function (name) {
        let match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.href);
        if (match) {
            return decodeURIComponent(match[1].replace(/\+/g, ' '));
        }
        return match
    },

    /** 获取cookie值 */
    getCookie: function (name) {
        let re = new RegExp(name + "=([^;]+)");
        let value = re.exec(document.cookie);
        return (value != null) ? unescape(value[1]) : null;
    },
    /** 设置cookie */
    setCookie: function (c_name, value, expiredays) {
        let exdate = new Date();
        exdate.setDate(exdate.getDate() + expiredays);
        document.cookie = c_name + "=" + escape(value) + ';path=/;' +
            ((expiredays == null) ? "" : "expires=" + exdate.toGMTString());
    },

    /** 设置session */
    setSession: function (key, value) {
        localStorage.setItem(key, value);
    },

    /** 获取session */
    getSession: function (key) {
        return localStorage.getItem(key);
    },

    /** 计算时间间隔 */
    countTimeGap: function (startTime) {
        startTime = startTime + '';
        let text;
        let stime = startTime * 1000;
        let date = new Date().getTime();
        let gapMin = Math.floor((date - stime) / 1000 / 60);
        if (gapMin <= 0) {
            //防止偶尔出现的js取时间不准确
            gapMin = 1;
        }
        let gapHour = Math.floor((date - stime) / 1000 / 60 / 60);

        if (gapHour <= 24) {
            text = gapHour + '小时前';
            if (gapMin < 60) {
                text = gapMin + '分钟前';
            }
        } else if (gapHour < 24 * 8) {
            gapHour = Math.floor(gapHour / 24);
            text = gapHour + '天前'
        } else if (gapHour >= 24 * 8) {
            let ddd = new Date(startTime * 1000);
            gapHour = (ddd.getMonth() + 1) + '-' + ddd.getDate();
            text = gapHour
        } else {
            //防止意外情况，暂时如此处理
            text = '刚刚'
        }
        return text;
    },
    /** 是否安卓手机 */
    isAndroid: function () {
        let u = navigator.userAgent;
        if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
            return true;
        }
        return false;
    },
    /**修改url中指定参数的值
     * url 目标url
     * arg 需要替换的参数名称
     * arg_val 替换后的参数的值
     * return url 参数替换后的url
     */
    changeURLArg: function (url, arg, arg_val) {
        var pattern = arg + '=([^&]*)';
        var replaceText = arg + '=' + arg_val;
        if (url.match(pattern)) {
            var tmp = '/(' + arg + '=)([^&]*)/gi';
            tmp = url.replace(eval(tmp), replaceText);
            return tmp;
        } else {
            if (url.match('[\?]')) {
                return url + '&' + replaceText;
            } else {
                return url + '?' + replaceText;
            }
        }
        return url + '\n' + arg + '\n' + arg_val;
    },
    mappingUser: function (json) {
        json.user_type = parseInt(json.type);
        json.user_id = json.id;
        json.sex = json.gender || 1;
        json.nick = json.nickname || '';
        json.address = json.addr || '';
        json.balance = json.bal || '';
        json.position = json.pos || '';
        json.company_name = json.com || '';
        json.activated = json.active || '';
        json.phone = json.mobile || '';
        json.avatar = json.avatar || "/img/supplier.jpg";
        json.level = json.level || 10;
        json.level_name = vipLevel_config[json.level];
        json.status = json.status || 0;
        delete json.type;
        delete json.id;
        delete json.gender;
        delete json.pos;
        delete json.com;
        delete json.addr;
        delete json.bal;
        delete json.nickname;
        delete json.active;
        return json;
    },
    mappingDemand: function (json) {
        var demand = $.extend({}, json, json.demand);
        delete demand.demand;
        if (!demand.cate) {
            demand.cate = "1"
        };
        if (demand.surr == 0) {
            demand.surr = "1"
        };
        if (!demand.color || demand.color == 0) {
            demand.color = "1"
        };
        demand.cate_name = demand_cate[demand.cate];
        if (demand.cate == 3) {
            demand.type_name = demand_config.rentalType[demand.type].name;
        } else {
            demand.type_name = demand_config.typeOptions[demand.type].name;
        }
        demand.location_name = demand_config.locationOptions[demand.surr].name;
        demand.color_name = demand_config.colorOptions[demand.color].name;
        demand.malf_name = demand_config.faultOptions[demand.malf].name;
        demand.location = demand.surr;
        demand.image = demand.img;
        demand.note = demand.remark;
        demand.intm = parseInt(demand.created_at);
        demand.uptm = parseInt(demand.updated_at);
        demand.address = demand.addr;
        demand.supplier_list = [];
        demand.user.sex = demand.user.gender;
        demand.user.nick = demand.user.nickname;
        demand.user.phone = demand.user.mobile;
        demand.my_offer = parseInt(demand.my_offer);
        if (demand.tag == "1" || demand.tag == "2") {
            demand.audio = "151217.mp3";
        }
        demand.budgetFormat = this.budget(demand.budget);
        demand.is_virt = demand.is_virt ? demand.is_virt : 0;
        //采购项目才用到的竞标结束计算
        demand.isEnd = false;
        if (demand.cate == 4 && demand.status == '10') {
            var dl = demand.deadline.replace(/\-/g, "/");
            dl = new Date(dl).getTime();
            var now = new Date().getTime();
            if (now >= dl) {
                demand.isEnd = true;
            }
        }
        delete demand.surr;
        delete demand.img;
        delete demand.addr;
        delete demand.remark;
        delete demand.created_at;
        delete demand.updated_at;
        delete demand.gender;
        delete demand.user.nickname;
        delete demand.user.gender;
        return demand;
    },
    mappingDemandSupplier: function (json) {
        let supplier = json;
        let grabList = [];
        for (let i = 0; i < supplier.length; i++) {
            let item = supplier[i];
            item.company_name = item.com;
            item.nick = item.nickname;
            item.succ_item = false;
            item.info = '拟出局';
            item.offer = parseInt(item.offer);
            /** 把只是聊过天的工程商暂时剔除 */
            if (item.status != '300') {
                grabList.push(item);
            }
        }
        return grabList
    },
    budget: function (money) {
        function std_money_format_in_th(money) {
            money = money + "";
            var intLen = money.split('.')[0].length;
            if (intLen > 4) {
                return { "budget": std_num_format(money / 10000), "unit": "万" }
            } else if (intLen > 3) {
                return { "budget": std_num_format(money / 1000), "unit": "千" }
            } else if (intLen > 2) {
                return { "budget": std_num_format(money / 100), "unit": "百" }
            } else {
                return { "budget": money, "unit": "" };
            }
        }

        function std_num_format(num) {
            num += '';
            var parts = num.split('.');
            var float_cnt = 0;
            if (parts.length > 1) {
                var deci = parts[1];
                float_cnt = (parseInt(deci) > 0) ? deci.length : 0;
            }

            var pureRes = number_format(num, Math.min(2, float_cnt));
            var ptIndex = pureRes.indexOf('.');
            if (ptIndex === -1) {
                // 整数
                return pureRes;
            } else {
                // 下面这些处理，是为了死也要保证小数点后末尾不能为0。即使这是不科学的四舍五入，产品及相关人员也认为这比科学要更好。好吧，我妥协
                var num = parseInt(pureRes.substr(ptIndex + 1));
                if (0 === num) {
                    // 123.00型
                    return pureRes.substr(0, ptIndex);
                } else if (0 === num % 10) {
                    // 123.40型
                    return pureRes.substr(0, pureRes.length - 1);
                } else {
                    return pureRes;
                }
            }
        }

        function number_format(number, decimals, decPoint, thousandsSep) { // eslint-disable-line camelcase

            number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
            var n = !isFinite(+number) ? 0 : +number
            var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
            var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep
            var dec = (typeof decPoint === 'undefined') ? '.' : decPoint
            var s = '';
            var toFixedFix = function (n, prec) {
                var k = Math.pow(10, prec)
                return '' + (Math.round(n * k) / k)
                    .toFixed(prec)
            }
            // @todo: for IE parseFloat(0.55).toFixed(0) = 0;
            s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.')
            if (s[0].length > 3) {
                s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
            }
            if ((s[1] || '').length < prec) {
                s[1] = s[1] || '';
                s[1] += new Array(prec - s[1].length + 1).join('0')
            }

            return s.join(dec)
        }

        var data = std_money_format_in_th(money);
        if (data.budget == "" || data.budget == 0) {
            data.budget = "";
        }
        return data;
    },
    // 组装数据并替换
    concatData: function (json) {
        var result = {
            user: json.user,
            demand: json.my_demand_list,
            demand_config: demand_config,
            supplier_vas: json.supplier_vas,
            pack: json.pack,
            joined_list: json.partic_demand_list,
            supplier_cnt: json.supplier_cnt,
            user_tags: json.user_tags,
        };
        // 数据替换
        $.extend(true, globalData, result);
        //触发全局的监听事件
        $(document).trigger('data_update');
        //缓存项目列表
        var prolist = globalData.project_list;
        prolist = JSON.stringify(prolist);
        localStorage.setItem("prolist", prolist);
    },

    removeWelcome: function () {
        if (globalData.hasWelcome) {
            $('#welcome').remove();
            globalData.hasWelcome = false;
        }
    },
    deepCopy: function (data) {
        return JSON.parse(JSON.stringify(data));
    },
    /** 弹出气泡*/
    tip: function (title, note, type, time) {
        /*
         title: 必填； －－提示信息标题；
         note:选填； －－提示信息详情；
         type:选填；("succ":成功提示－绿色对勾图标, "fail": 错误提示－红色叉叉图标)，默认"succ"
         time:选填，默认3000ms
        */
        let timeout = 3000;
        time ? timeout = time : 0;
        let tipDom = '<div class="TipPanel"><div class="Tip"><h4 class="tip-title"><span class="icon-checkmark"></span><i>' + title + '</i></h4><p class="tip-note">' + note + '</p></div></div>';
        //如果没有详细信息，则调整界面显示
        if (note == '') {
            tipDom = tipDom.replace('tip-title', 'tip-title just-title');
            tipDom = tipDom.replace('tip-note', 'tip-note hide');
        }
        //如果是错误提示，则更改icon
        if (type == 'fail') {
            tipDom = tipDom.replace('icon-checkmark', 'icon-x');
        }
        $('body').append(tipDom);
        setTimeout(function () {
            $('.TipPanel .Tip').css('bottom', '.2rem');
        }, 1);
        //3秒关闭提示框
        setTimeout(function () {
            $('.TipPanel .Tip').css('bottom', '-0.85rem');
            $('.TipPanel').fadeOut();
            setTimeout(function () {
                $('.TipPanel').remove();
            }, 310);
        }, timeout);
    },
    /** 顶部提示*/
    topTip: function (text) {
        $('#TopTip').html(text).slideDown();
        setTimeout(function () {
            $('#TopTip').slideUp();
        }, 3000);
    }
};